package com.eostoken.eos_wallet.ui.activity;

import android.os.Bundle;
import android.text.InputFilter;

import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;

import com.blankj.utilcode.util.BarUtils;
import com.blankj.utilcode.util.FragmentUtils;
import com.eostoken.eos_wallet.R;
import com.eostoken.eos_wallet.base.BaseActivity;
import com.eostoken.eos_wallet.ui.fragment.ResourceAdministrationFragment;
import com.eostoken.eos_wallet.ui.fragmentfactory.FragmentFactory;
import com.eostoken.eos_wallet.utils.CashierInputFilter;
import com.fredy.mvp.BasePresenter;
import com.fredy.mvp.BaseView;
import com.fredy.mvp.Model;
import com.google.android.material.textfield.TextInputEditText;

import java.math.BigDecimal;

import static com.eostoken.eos_wallet.utils.Constants.CREATE_WALLET;
import static com.eostoken.eos_wallet.utils.Constants.EXTRA_ACCOUNT_INFO;
import static com.eostoken.eos_wallet.utils.Constants.RESOURCE_ADMINISTRATION;

public class ResourceAdministrationActivity extends BaseActivity {

    public CashierInputFilter filter;
    public static ResourceAdministrationActivity activity;
    public static final BigDecimal percent = new BigDecimal(100);
    public static final BigDecimal bdToEOS = new BigDecimal(10000);

    @Override
    protected void initData() {
        filter = new CashierInputFilter();
        activity = this;
    }

    @Override
    public void initView() {
        BarUtils.setStatusBarColor(this, ContextCompat.getColor(this, R.color.app_color_blue));
        BarUtils.setStatusBarLightMode(this, false);
        Fragment fragment = FragmentFactory.getInstatic().getFragment(RESOURCE_ADMINISTRATION);
        if (fragment != null) {
            FragmentUtils.add(getSupportFragmentManager(), fragment, R.id.frag_container);
        }
    }

    @Override
    public int getContentView() {
        return R.layout.activity_child;
    }

    @Override
    public Model createModel() {
        return null;
    }

    @Override
    public BaseView createView() {
        return null;
    }

    @Override
    public BasePresenter createPresenter() {
        return null;
    }

    public void setEditableEditText(TextInputEditText editText, boolean isEnabled) {
        editText.setEnabled(isEnabled);//去掉点击时编辑框下面横线:
        editText.setFocusable(isEnabled);//不可编辑
        editText.setFocusableInTouchMode(isEnabled);//不可编辑
    }


    public void cashierFiltersEditText(TextInputEditText editText) {
        InputFilter[] filters = {filter};
        editText.setFilters(filters);
    }

    @Override
    public boolean isShowState() {
        return true;
    }
}
